package com.tang.springbootswagger.controller;/*
 *   @author Dram
 *   @create 2021-04-08 9:28
 */

import com.tang.springbootswagger.pojo.Student;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/student")
@Api(value = "学生相关接口",tags = {"学生相关接口"})
public class StudentController {

    @GetMapping("/list")
    @ApiOperation("列表")
    public List<Student> list(){
        List<Student> students = new ArrayList<>();
        students.add(new Student(1,2,"小明"));
        students.add(new Student(2,3,"小红"));
        students.add(new Student(3,4,"小李"));
        return students;
    }


    @PutMapping("/edit")
    @ApiOperation("修改")
    public Map<String, Object> edit(Student student) {
        Map<String,Object> map = new HashMap<>();
        map.put("code",1000);
        map.put("flag",true);
        map.put("data","成功");
        return map;
    }
}
